﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace IEC
{
    /// <summary>
    /// SavedModItemList.xaml 的交互逻辑
    /// </summary>
    public partial class SavedModItemList : UserControl
    {
        SavedModList items;
        Action<SavedModList> deleteMe;
        public SavedModItemList(SavedModList items, Action<SavedModList> deleteMe)
        {
            this.items = items;
            this.deleteMe = deleteMe;
            InitializeComponent();
            Describe.Text = items.name;
            foreach(var mod in items.list.List)
            {
                mods.Children.Add(new ModItemUI(mod));
            }
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show(items.list.SaveLists(),"提示");
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            deleteMe?.Invoke(items);
        }

        private void Describe_TextChanged(object sender, TextChangedEventArgs e)
        {
            items.name = Describe.Text;
        }
    }
}
